package com.itmuch.cms.admin.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.itmuch.cms.admin.domain.Admin;
import com.itmuch.cms.admin.persistence.AdminMapper;
import com.itmuch.cms.admin.service.IAdminService;
import com.itmuch.core.page.PageInfo;
import com.itmuch.core.page.PageVo4BsGrid;

@Service
public class AdminServiceImpl implements IAdminService {
    @Resource
    private AdminMapper adminMapper;

    @Override
    public int deleteById(Integer id) {
        return this.adminMapper.deleteById(id);
    }

    @Override
    public int insert(Admin record) {
        return this.adminMapper.insert(record);
    }

    @Override
    public Admin selectById(Integer id) {
        return this.adminMapper.selectById(id);
    }

    @Override
    public int updateById(Admin admin) {
        return this.adminMapper.updateById(admin);
    }

    @Override
    public Admin selectByUsername(String username) {
        return this.adminMapper.selectByUsername(username);
    }

    @Override
    public PageInfo<Admin> selectPaged(PageVo4BsGrid vo) {
        PageHelper.startPage(vo.getCurPage(), vo.getPageSize());
        List<Admin> list = this.adminMapper.selectAll();
        return new PageInfo<>(list);
    }

}
